package com.lagou.rpc.provider1;


import com.alibaba.fastjson.JSON;
import com.lagou.rpc.common.ServiceInfo;
import com.lagou.rpc.provider1.server.RpcServer;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.zookeeper.CreateMode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.nio.charset.StandardCharsets;

@SpringBootApplication
public class ServerBootstrapApplicat implements CommandLineRunner {

    @Autowired
    RpcServer rpcServer;

    public static void main(String[] args) {
        SpringApplication.run(ServerBootstrapApplicat.class,args);
    }

    @Override
    public void run(String... args) throws Exception {
        new Thread(new Runnable() {
            @Override
            public void run() {
                String ip = "127.0.0.1";
                int port = 8891;
                //启动服务
                rpcServer.start(ip,port);
            }
        }).start();
    }
}
